package com.example.springboot.config.postProcessor;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.stereotype.Component;

/**
 * @Author:ChenZhangKun
 * @Date: 2021/5/17 15:41
 */
@Component
public class MyBeanFactoryPostProcessor implements BeanFactoryPostProcessor {
    @Override
    public void postProcessBeanFactory(ConfigurableListableBeanFactory configurableListableBeanFactory) throws BeansException {
        // 拿到beanDefinition
        BeanDefinition deptController = configurableListableBeanFactory.getBeanDefinition("deptController");
        System.out.println("拿到deptController的bean定义信息了" + deptController.getBeanClassName());
        // 执行自己的业务逻辑
    }
}
